package service.impl;

import dao.SysUserDao;
import dao.impl.SysUserDaoImpl;
import pojo.SysUser;
import service.SysUserService;
import util.MD5Util;

import java.util.List;

public class SysUserServiceImpl implements SysUserService {
    private SysUserDao sysUserDao = new SysUserDaoImpl()  ;
    @Override
    public int regist(SysUser user) {
        //
        user.setUserPwd(MD5Util.encrypt(user.getUserPwd()));
         //
        return  sysUserDao.addUser(user);
    }
    @Override
    public SysUser login(SysUser user){
        user.setUserPwd(MD5Util.encrypt(user.getUserPwd()));
        return  sysUserDao.findUser(user);
    }
    @Override
    public SysUser findByUsername(String username){
        return sysUserDao.findByUsername(username);
    }


}
